<?php
namespace app\admin\controller;

use system\core\Controller;
use think\facade\Db;
use app\admin\model\User;
use app\admin\model\Test;

use Flight;

class IndexController extends Controller
{
    public function indexAction()
    {
        $data = Db::table('users')->where('id', 1)->select();

    	// $data = User::select();

        // $user = new Test();
        // $data = $user->findAll();

        // $db = Flight::medoo();
        // $data = $db->select('users', '*');

        $this->session->set('user_id', 123);
        echo $this->session->get('user_id');

        $this->assign('users', $data);
        $this->render();
    }

    public function testAction($id,$val)
    {
        echo $this->request->query['id'];
        echo "admin: id= {$id}";
        echo $this->getModule().$this->getController().$this->getAction();
        // var_dump($this->request->ajax); 
        var_dump(is_ajax()); 
        // echo $val;
        // $this->response->write("Hello, World!");
        // return json(['id' => 123]);

    }
}
